package com.xm.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

public class CustomBeanPostProcessor implements BeanPostProcessor {
    
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof LifecycleDemoBean) {
            System.out.println("3. BeanPostProcessor.postProcessBeforeInitialization() 执行");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof LifecycleDemoBean) {
            System.out.println("7. BeanPostProcessor.postProcessAfterInitialization() 执行");
        }
        return bean;
    }
}